]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
clock: update every second
authorDavid Zeuthen <davidz@redhat.com>
Mon, 14 Mar 2011 14:32:15 +0000 (10:32 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 14 Mar 2011 18:36:24 +0000 (14:36 -0400)
If we don't update every second, we may show the wrong time for up to
a minute on 1. resume; or 2. when changing the time; or 3. when
changing the timezone. This is both annoying and and leads to people
thinking that the tool for changing the time / timezone is broken.

https://bugzilla.gnome.org/show_bug.cgi?id=635840

Signed-off-by: David Zeuthen <davidz@redhat.com>
js/ui/dateMenu.js

index ad2c112efb3fada070c2a8b86ff3fa66993c328c..8d35bbcef4aaa4bcf2f3b2a76c41aef34a5e9bf3 100644 (file)
@@ -185,21 +185,6 @@ DateMenuButton.prototype = {
         }
 
         let displayDate = new Date();
-        let msecRemaining;
-        if (showSeconds) {
-            msecRemaining = 1000 - displayDate.getMilliseconds();
-            if (msecRemaining < 50) {
-                displayDate.setSeconds(displayDate.getSeconds() + 1);
-                msecRemaining += 1000;
-            }
-        } else {
-            msecRemaining = 60000 - (1000 * displayDate.getSeconds() +
-                                     displayDate.getMilliseconds());
-            if (msecRemaining < 500) {
-                displayDate.setMinutes(displayDate.getMinutes() + 1);
-                msecRemaining += 60000;
-            }
-        }
 
         this._clock.set_text(displayDate.toLocaleFormat(clockFormat));
 
@@ -209,7 +194,7 @@ DateMenuButton.prototype = {
         dateFormat = _("%A %B %e, %Y");
         this._date.set_text(displayDate.toLocaleFormat(dateFormat));
 
-        Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClockAndDate));
+        Mainloop.timeout_add_seconds(1, Lang.bind(this, this._updateClockAndDate));
         return false;
     },